{include file="public/head"/}
<link rel="stylesheet" href="__PUBLIC__phone/css/account.css"/>
<body>
<!--头部-->
<header id="headers">
    <div class="container">
        <div class="row">
            <div class="col-xs-12">
                <a href="javascript:;" class="leftRuted glyphicon glyphicon-menu-left pull-left" ></a>
                <p>订单支付</p>
            </div>
        </div>
    </div>
</header>
<!-- 我的账户-充值 -->
<div class="account normalBox">
    <div class="container countwrap">
        <ul class="payul">
            <li>
                订单编号：<span>{$details.order_number}</span>
            </li>
            <li>
                订单金额：<span>￥{$details.money}元</span>
            </li>
            <li>
                账户余额：<span>￥{$balance}元</span>
            </li>
            <li>
                {if condition="$balance elt $details['money'] "}
                <a href="javascript:reminder('账户余额不足，请先充值！');" class="payaBtn">确认支付</a>
                {else/}
                <a href="javascript:;" class="payaBtn">确认支付</a>
                {/if}
            </li>
        </ul>
    </div>
</div>
{if condition="$balance egt $details['money'] "}
<script type="text/javascript">
    $(function(){
        var flag = true;
        $('.payaBtn').on('click',function(){
            if(!flag){
                return false;
            }
            var oNumber = "<?php echo $details['order_number']; ?>";
            flag = false;
            $.post("{:url('/home/Order/payOrder')}",{'order_number':oNumber},function(data){
                reminder(data.msg,2000,function(){
                    if(!data.code){   // 支付成功，返回订单
                        window.location.href = "{:url('/home/Order/index')}";
                    } else {   // 支付失败
                        flag = true;
                    }
                });
            })
        })
    })
</script>
{/if}
</body>
</html>